<!-- switchDark/index.vue -->
<template>
  <el-switch
    v-model="globalStore.isDark"
    @change="switchDark"
    inline-prompt
    :active-icon="Sunny"
    :inactive-icon="Moon"
  />
</template>

<script lang="ts">
import { useTheme } from "@/hooks/useTheme";
import { useGlobalStore } from "@/stores/module/global";
import { Sunny, Moon } from "@element-plus/icons-vue";

export default {
  name: "SwitchDark",
  setup() {
    const { switchDark } = useTheme();
    const globalStore = useGlobalStore();

    return {
      switchDark,
      globalStore,
      Sunny,
      Moon,
    };
  },
};
</script>
